//
//  Timer.hpp
//  Simulation
//
//  Created by Christopher Kemsley on 2/24/12.
//  Copyright (c) 2012 iAppolopolis. All rights reserved.
//

#ifndef Simulation_Timer_hpp
#define Simulation_Timer_hpp

#include "Types.hpp"
#include "RunLoop.hpp"
#include "System.hpp"
#include "Invocation.hpp"



NamespaceBegin






class	Timer : public RunLoopSource
{
public:
	
	Timer	( Interval const & inInterval , Invocation * inInvocation ) ;
	virtual ~Timer () ; // disables timer
	
	
	bool	isPaused () const ;
	void	setIsPaused ( bool paused ) ;
	
	void	restart	( Interval const & newInterval ) ;
	
	
	
private:
	virtual void			fire () ;
	virtual Interval const	fireDate () ;
	
	bool		mIsPaused ;
	Interval	mFireDate ;
	Interval	mInterval ;
	Invocation*	mInvocation ;
};





NamespaceEnd
#endif
